package com.ruoyi.question.service.lmpl;
import java.util.Date;
import java.util.List;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.question.domain.ExpressQuestion;
import com.ruoyi.question.domain.ExpressQuestionKind;
import com.ruoyi.question.mapper.QuestionMapper;
import com.ruoyi.question.service.IQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 公告Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-08-22
 */
@Service
public class QuestionServiceImpl implements IQuestionService
{
    @Autowired
    private QuestionMapper questionMapper;

    @Override
    public PageInfo<ExpressQuestionKind> questionKindList(ExpressQuestionKind questionKind) {
        PageHelper.startPage(questionKind.getPageNum(),questionKind.getPageSize());
        List<ExpressQuestionKind> questionKindList = questionMapper.questionKindList(questionKind);
        PageInfo<ExpressQuestionKind> questionKindListInfo = new PageInfo<>(questionKindList);
        return questionKindListInfo;
    }
    @Override
    public PageInfo<ExpressQuestion> questionList(ExpressQuestion question) {
        PageHelper.startPage(question.getPageNum(),question.getPageSize());
        List<ExpressQuestion> questionList = questionMapper.questionList(question);
        PageInfo<ExpressQuestion> questionPageInfo = new PageInfo<>(questionList);
        return questionPageInfo;
    }

    @Override
    public int updateFalse(Long id) {
        return questionMapper.updateFalse(id);
    }

    @Override
    public int updateTrue(Long id) {
        return questionMapper.updateTrue(id);
    }

    @Override
    public int deleteQuestion(Long id) {
        return questionMapper.deleteQuestion(id);
    }

    @Override
    public List<ExpressQuestionKind> questionKind(ExpressQuestionKind kind) {
        return questionMapper.questionKind(kind);
    }

    @Override
    public int questionAdd(ExpressQuestion question) {
//        ExpressQuestionKind expressQuestionKind = questionMapper.questionKindListById(question.getId());
//        if(question.getLanguage()==1){
//            question.setCnName(expressQuestionKind.getQuestionType());
//        }else{
//            question.setEnName(expressQuestionKind.getQuestionEnglishType());
//        }
        question.setCreateDate(new Date());
        question.setStatus(1L);
        return questionMapper.questionAdd(question);
    }



    @Override
    public int questionKindAdd(ExpressQuestionKind questionKind) {
        questionKind.setStatus(1L);
        questionKind.setQuote(2L);
        questionKind.setCreateDate(new Date());
        return questionMapper.questionKindAdd(questionKind);
    }

    @Override
    public int questionKindUpdate(ExpressQuestionKind questionKind) {
        questionKind.setLastDate(new Date());
        return questionMapper.questionKindUpdate(questionKind);
    }

    @Override
    public int questionUpdate(ExpressQuestion question) {
        question.setLastDate(new Date());
        return questionMapper.questionUpdate(question);
    }
    @Override
    public int deleteQuestionKind(Long id) {
        return questionMapper.deleteQuestionKind(id);
    }

    @Override
    public int updatKindFalse(Long id) {
        return questionMapper.updatKindFalse(id);
    }

    @Override
    public int updateKindTrue(Long id) {
        return questionMapper.updateKindTrue(id);
    }


//
//    @Override
//    public PageInfo<ExpressList> selectExpressListList(ExpressList expressList)
//    {
//        PageHelper.startPage(expressList.getPageNum(),expressList.getPageSize());
//        List<ExpressList> expressListList = expressListMapper.selectExpressListList(expressList);
//        PageInfo<ExpressList> expressListPageInfo = new PageInfo<>(expressListList);
//        return expressListPageInfo;
//    }
//
//
//    @Override
//    public PageInfo<ExpressList> selectExpressListListMember(ExpressList expressList) {
//        PageHelper.startPage(expressList.getPageNum(),expressList.getPageSize());
//        List<ExpressList> expressListList = expressListMapper.selectExpressListMemberList(expressList);
//        PageInfo<ExpressList> expressListPageInfo = new PageInfo<>(expressListList);
//        return expressListPageInfo;
//    }
//
//    @Override
//    public PageInfo<ExpressAuth> authList(ExpressAuth expressAuth) {
//        PageHelper.startPage(expressAuth.getPageNum(),expressAuth.getPageSize());
//        List<ExpressAuth> expressAuthsList = expressListMapper.authList(expressAuth);
//        PageInfo<ExpressAuth> expressAuthsListInfo = new PageInfo<>(expressAuthsList);
//        return expressAuthsListInfo;
//    }
//
//    @Override
//    public ExpressDetial getDetialList(Long id) {
//        return expressListMapper.getDetialList(id);
//    }
//
//
//    @Override
//    public ExpressDetial getDetialListPhone(Long phone) {
//        return  expressListMapper.getDetialListPhone(phone);
//    }
//
//
//
//    @Override
//    public int updateStatusFalse(Long id) {
//        return expressListMapper.updateStatusFalse(id);
//    }
//
//    @Override
//    public int updateStatusTrue(Long id) {
//        return expressListMapper.updateStatusTrue(id);
//    }
//
//    @Override
//    public int resetPassword(Long id) {
//        ExpressList expressList =expressListMapper.selectById(id);
//        expressList.setPassword("123456");
//        return  expressListMapper.resetPassword(expressList);
//
//    }
//
//    @Override
//    public int sernullPayPassword(Long id) {
//        ExpressList expressList =expressListMapper.selectById(id);
//        expressList.setPayPassword(null);
////        修改支付密码状态
//        ExpressDetial expressDetial = expressListMapper.selectDetialById(id);
//        expressDetial.setPayPasswordStatus(2L);
//        expressListMapper.updateDetialPayPasswordStatus(expressDetial);
//        return  expressListMapper.sernullPayPassword(expressList);
//
//    }
//
//    @Override
//    public int updateAccountStatusTrue(Long id) {
//        return expressListMapper.updateAccountStatusTrue(id);
//    }
//
//    @Override
//    public int updateAccountStatusFalse(Long id) {
//        return expressListMapper.updateAccountStatusFalse(id);
//    }
//
//    @Override
//    public int expressAdd(ExpressList expressList){
//        expressList.setStatus(2L);
//        expressList.setCreateDate(new Date());
//        expressList.setIsDel(1L);
//        expressList.setIsVip(1L);
//        expressList.setRegistrationType(2L);
//        return expressListMapper.expressAdd(expressList);
//    }
//
//
//
//    @Override
//    public int updateAuthFalse(Long id) {
//       ExpressAuth expressAuth = expressListMapper.selectAuthByid(id);
//       expressAuth.setStatusa(3L);
//
//        return expressListMapper.updateAuthStatus(expressAuth);
//    }
//
//
//    @Override
//    public int updateRefuseReason(ExpressAuth expressAuth) {
//        expressAuth.setPassDate(new Date());
//        ExpressSystemMassage expressSystemMassage = new ExpressSystemMassage();
//        expressSystemMassage.setRegisterIp(expressAuth.getRegisterIp());
//        expressSystemMassage.setCreateDate(new Date());
//        expressSystemMassage.setContent("拒绝了审核");
//        expressListMapper.insertSystemMessage(expressSystemMassage);
//        return expressListMapper.updateRefuseReason(expressAuth);
//    }
//
//    @Override
//    public int updateAuthTure(Long id) {
//        ExpressAuth expressAuth = expressListMapper.selectAuthByid(id);
//        expressAuth.setStatusa(1L);
//        expressAuth.setPassDate(new Date());
////        ExpressSystemMassage experienceSystemMassage =  expressListMapper.selectSystemMessageByRegisterIp(id);
//        ExpressSystemMassage expressSystemMassage = new ExpressSystemMassage();
//        expressSystemMassage.setRegisterIp(id);
//        expressSystemMassage.setCreateDate(new Date());
//        expressSystemMassage.setContent("同意了审核");
//        expressListMapper.insertSystemMessage(expressSystemMassage);
//        return expressListMapper.updateAuthStatus(expressAuth);
//    }
//
//    @Override
//    public ExpressAuth getAuthDetialList(Long id) {
//        return expressListMapper.getAuthDetialList(id);
//    }


}
